﻿@*@model IEnumerable<BlackBox.ActiveGame>*@
@model BlackBox.Controllers.GameViewModel
@{
    ViewBag.Title = "JoinGame";
}
    
<div id="JoinGameTable">
    <p>
        <a href="~/Home/Main">Home</a>
         > 
        <a href="~/Game/PlayGame">Play Game</a>
         >
        <a href="~/Game/Category/@Model.CategoryData.id">@Model.CategoryData.categorytitle</a>
         >
        <a href="~/Game/Game/@Model.GameData.id">@Model.GameData.name</a>
    </p>
    <h3>JoinGame</h3>

    <table>
        <tr>
			<th>Name</th>
			<th>Owner</th>
			<th>Num Players</th>
            <th>join</th>
		</tr>
        @foreach(var Game in Model.ActiveGameListData)
        {
		    <tr>
			    <td>@Game.name</td>
			    <td>@Game.owner</td>
			    <td>@Game.numberofplayers / @Game.maxplayers</td>
                @if (Game.open == true)
                {
                     <td> <a href="~/Game/Play/@Game.id">Join Game</a> </td>
                }
                @if(Game.open == false)
                {
                    <td>Game is not open</td>
                }
		    </tr>
        }
	</table>
</div>